package com.stu.spring04.aspect;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * ClassName: LogAspect
 * Package: com.stu.spring04.aspect
 * Description: @Version 1.0
 */
@Aspect
@Component
public class LogAspect {
    //拦截注解
    @Pointcut("@annotation(com.stu.spring04.annotation.Log)")
    public void myMethod(){

    }
    @Before("myMethod()")
    public void beforeMethod(){
        System.out.println("我被log拦截");
    }
    @After("myMethod()")
    public void afterMethod(){
        System.out.println("我被log放走");
    }
}
